/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package MainPack;

import EntityGameObject.Pet;
import MaterialPack.Button;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

/**
 * @author Van persie
 */

public class MainMIDlet extends MIDlet {
     public static final int SCENE_MENU = 0;
     public static final int SCENE_MANAGEMENT = 1;
     public static final int SCENE_PLAYPET = 2;
     public static final int SCENE_ACTIONTIME = 3;
     
    
    
	private Display display; // The display

	//private ImageCanvas canvas; // Canvas
        private MenuCanvas MenuCanvas;
        private PetManagement PetManagementCanvas;
        private PlayPetCanvas PlayPetCanvas;
        
        private Pet pet = null;
        
	public MainMIDlet() {
                pet = new Pet();
		display = Display.getDisplay(this);
                PetManagementCanvas = new PetManagement(this);
		PlayPetCanvas = new PlayPetCanvas(this);
                MenuCanvas = new MenuCanvas(this);
                
                PetManagementCanvas.setFullScreenMode(true);
                PlayPetCanvas.setFullScreenMode(true);
                MenuCanvas.setFullScreenMode(true);
	}

	protected void startApp() {                
		display.setCurrent(PetManagementCanvas);
	}
        public void SwitchTo(int canvas)
        {
            switch(canvas)
            {
                case SCENE_MENU:
                    display.setCurrent(MenuCanvas);
                    break;
                    
                case SCENE_MANAGEMENT:
                    display.setCurrent(PetManagementCanvas);
                    break;
                    
                case SCENE_PLAYPET:
                    PlayPetCanvas.StartTimer();
                    display.setCurrent(PlayPetCanvas);
                                        break;
            }
        }

	protected void pauseApp() {
	}

        
	protected void destroyApp(boolean unconditional) {
            
	}

	public void exitMIDlet() {
		destroyApp(true);
		notifyDestroyed();
	}

    /**
     * @return the pet
     */
    public Pet getPet() {
        return pet;
    }

    /**
     * @param pet the pet to set
     */
    public void setPet(Pet pet) {
        this.pet = pet;
    }
}